package com.hangzhou.welbeing.welbeinginstrument.adapter;

import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.hangzhou.welbeing.welbeinginstrument.R;

import java.util.ArrayList;
import java.util.List;

/**
 * 杭州惟君医疗科技有限公司15
 * Created by 20433 on 2018/1/31
 */

public class PictureAdapter extends PagerAdapter {
    private List<String> images = new ArrayList();
    private Context mcontent;
    private List<View> picture = new ArrayList();
    private ImageView mageView;

    public PictureAdapter(List<String> paramList, List<View> paramList1, Context paramContext) {
        this.images.addAll(paramList);
        this.picture.addAll(paramList1);
        this.mcontent = paramContext;
    }

    public void destroyItem(ViewGroup paramViewGroup, int paramInt, Object paramObject) {
        paramViewGroup.removeView((View) this.picture.get(paramInt));
    }

    public int getCount() {
        return this.images.size();
    }

    public Object instantiateItem(ViewGroup paramViewGroup, int posstion) {
        paramViewGroup.addView(picture.get(posstion));
        mageView = (ImageView) picture.get(posstion).findViewById(R.id.picture_01_picture_01);
        Glide.with(mcontent).load(images.get(posstion)).into(mageView);
        return picture.get(posstion);
    }

    public boolean isViewFromObject(View paramView, Object paramObject) {
        return paramView == paramObject;
    }

}
